import cv2
import numpy as np



if __name__ == '__main__':
    image_np = cv2.imread('work1.jpg')
    x_min_l, x_max_l = 58, 180
    y_min_l, y_max_l = 383, 1145

    ROI_image_l = image_np.copy()[y_min_l:y_max_l, x_min_l:x_max_l]
    line_width = 2
    cv2.rectangle(image_np, (x_min_l, y_min_l), (x_max_l, y_max_l), (0, 0, 255), line_width)

    x_min_r, x_max_r = 1100, 1250
    y_min_r, y_max_r = 390, 1170

    ROI_image_r = image_np.copy()[y_min_r:y_max_r, x_min_r:x_max_r]
    line_width = 2
    cv2.rectangle(image_np, (x_min_r, y_min_r), (x_max_r, y_max_r), (0, 0, 255), line_width)

    x_min_m, x_max_m = 455, 850
    y_min_m, y_max_m = 140, 280

    ROI_image_m = image_np.copy()[y_min_m:y_max_m, x_min_m:x_max_m]
    line_width = 2
    cv2.rectangle(image_np, (x_min_m, y_min_m), (x_max_m, y_max_m), (0, 0, 255), line_width)


    # cv2.imshow('', rotation_image)
    cv2.imshow('', ROI_image_l)
    cv2.imshow('', ROI_image_r)
    cv2.imshow('', ROI_image_m)
    cv2.imwrite('zuoye2_l.jpg', ROI_image_l)
    cv2.imwrite('zuoye2_r.jpg', ROI_image_r)
    cv2.imwrite('zuoye2_m.jpg', ROI_image_m)
    cv2.waitKey(0)